<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateBooksTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('books', function (Blueprint $table) {
			$table->bigIncrements('id')->unsigned(false);
			$table->bigInteger('category_id')->nullable();
			$table->foreign('category_id')->references('id')->on('categories');
			$table->string('name')->nullable();
			$table->string('abstract')->nullable();
			$table->string('thumbnail')->nullable();
			$table->string('author')->nullable();
			$table->string('status', 64)->nullable();
			$table->boolean('completed')->default(false);
			$table->string('source')->nullable();
			$table->integer('likes')->default(0);
			$table->integer('font_num')->default(0);
			$table->integer('clicks')->default(0);
			$table->bigInteger('downloads')->default(0);
			$table->nullableTimestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('books');
    }
}
